<template>
	<view class="">
		<view class="boxes">
			<view class="namebox">
				<view class="name">{{obj.clientname}}</view>
				<view class="telephone">{{obj.contact_number}}</view>
			</view>
			<view class="lock" @click.stop="lock(obj.id)">锁定</view>
		</view>

		<view class="cont" v-for="(item,index) in arr" :key="index">
			<view class="describe">
				{{item.describe}}
			</view>
			<view class="agentbox">
				<view class="agentleft">
					<image :src="item.agent_user_id.header_img" mode=""></image>
					<text class="agentname">{{item.agent_user_id.name}}</text>
					<text class="agentphone">{{item.agent_user_id.phone}}</text>
				</view>
				<view class="agentright">
					{{item.create_time}}
				</view>
			</view>
		</view>


	</view>
</template>

<script>
	import {
		getgenjin,
		lockpassenger
	} from "../../api/api/index"
	export default {
		data() {
			return {
				isOk: false,
				arr: [],
				page: 0,
				limit: 20,
				id: 0,
				obj: {}
			}
		},
		methods: {
			public() {
				if (this.isOk) {
					return uni.showToast({
						icon: 'none',
						title: '没有更多了'
					})
				}
				uni.showLoading({
					mask: true,
					title: '加载中'
				})
				this.page++
				let data = {
					page: this.page,
					limit: this.limit,
					id: this.obj.id
				}
				getgenjin(data).then(res => {
					uni.hideLoading()
					this.arr = this.arr.concat(res.data)
					if (res.data.length < this.limit) {
						this.isOk = true
					}
				})
			},
			lock(id){
				lockpassenger({id:id}).then(res=>{
					uni.showToast({
						title:res.message,
						icon:"none",
						duration:1500
					})
					setTimeout(function(){
						uni.navigateBack({})
					},1500)
				})
			}
		},
		onShow() {
			this.isOk = false
			this.arr = []
			this.page = 0
			this.public()
		},
		onLoad(e) {
			this.obj = e
		}
	}
</script>

<style scoped lang="less">
	.boxes {
		width: 100%;
		height: 160rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		margin-bottom: 30rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.namebox {
			.name {
				font-family: MicrosoftYaHei-Bold;
				font-size: 30rpx;
				letter-spacing: 0rpx;
				color: #000000;
				font-weight: 700;
				margin-right: 40rpx;
			}

			.telephone {
				color: #666666;
				font-family: PingFang-SC-Heavy;
				font-size: 24rpx;
				margin-right: 40rpx;
				margin-top: 20rpx;
			}
		}


		.indetiy {
			display: inline-block;
			width: 79rpx;
			height: 33rpx;
			background-color: #ffcc00;
			border-radius: 17rpx;
			line-height: 33rpx;
			text-align: center;
			color: #993300;
			font-size: 22rpx;
			font-family: MicrosoftYaHei;
			margin-right: 40rpx;
		}

		.lock {
			display: inline-block;
			width: 174rpx;
			height: 61rpx;
			background-color: #ffffff;
			border-radius: 31rpx;
			border: solid 3rpx #df4744;
			line-height: 61rpx;
			text-align: center;
			font-family: MicrosoftYaHei;
			font-size: 30rpx;
			color: #d72f2c;
			margin-left: 90rpx;
		}
	}

	.cont {
		width: 709rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		margin: 0 auto;
		padding: 41rpx 28rpx 16rpx 28rpx;
		box-sizing: border-box;
		margin-top: 87rpx;

		.describe {
			font-family: MicrosoftYaHei;
			font-size: 24rpx;
			color: #666666;
		}

		.agentbox {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 20rpx;
			.agentleft {
				display: flex;
				align-items: center;

				image {
					width: 46rpx;
					height: 46rpx;
					border-radius: 46rpx;
				}

				.agentname {
					font-family: MicrosoftYaHei;
					font-size: 24rpx;
					color: #000000;
				}

				.agentphone {
					font-family: PingFang-SC-Heavy;
					font-size: 20rpx;
					color: #666666;
				}
			}

			.agentright {
				font-family: MicrosoftYaHei;
				font-size: 18rpx;
				color: #cccccc;
			}
		}
	}
</style>
